/*
 * panNuevoCapacitaciones.java
 *
 * Created on 15 de mayo de 2007, 8:25
 */

package legajopersonal;

/**
 *
 * @author  Administrador
 */
public class jPNuevoCapacitaciones extends Panel_Legajo {
    
    /** Creates new form panNuevoCapacitaciones */
   /* public panNuevoCapacitaciones(javax.swing.JDialog jd) {
        this.jd = jd;
        initComponents();
    }*/
    public jPNuevoCapacitaciones() {        
        initComponents();
        this.txtcursoCapac.requestFocus();
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtcodCapac = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtcursoCapac = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        cmbespecialidadCapac = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        cmbNivelCapac = new javax.swing.JComboBox();
        jLabel11 = new javax.swing.JLabel();
        cmbeventoCapac = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        txtCECapac = new javax.swing.JTextField();
        btnGuardarCapaNuevo = new javax.swing.JButton();
        btnCancelarCapaNuevo = new javax.swing.JButton();
        btnSalirCapaNuevo = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        cmbrangoCapac = new javax.swing.JComboBox();
        try{
            mascaraInicio = new javax.swing.text.MaskFormatter("##/##/####");
            mascaraFin= new javax.swing.text.MaskFormatter("##/##/####");
        }catch(Exception e){
        }
        ftxtFecInicioCapac = new javax.swing.JFormattedTextField();
        this.ftxtFecInicioCapac = new javax.swing.JFormattedTextField(this.mascaraInicio);
        ftxtFecFinCapac = new javax.swing.JFormattedTextField();
        ftxtCosto = new javax.swing.JFormattedTextField();
        ftxtDuracion = new javax.swing.JFormattedTextField();
        ftxtCalificacion = new javax.swing.JFormattedTextField();
        jLabel14 = new javax.swing.JLabel();

        jLabel1.setFont(new java.awt.Font("Verdana", 1, 14));
        jLabel1.setText("Capacitaciones Complementarias");

        jLabel3.setText("C\u00f3digo");

        txtcodCapac.setEnabled(false);

        jLabel4.setText("Nombre del Curso");

        txtcursoCapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtcursoCapacKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtcursoCapacKeyTyped(evt);
            }
        });

        jLabel5.setText("Especialidad");

        cmbespecialidadCapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                cmbespecialidadCapacKeyPressed(evt);
            }
        });

        jLabel6.setText("Costo");

        jLabel7.setText("Duraci\u00f3n");

        jLabel8.setText("Fecha de Inicio");

        jLabel9.setText("Fecha de Fin");

        jLabel10.setText("Nivel");

        cmbNivelCapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                cmbNivelCapacKeyPressed(evt);
            }
        });

        jLabel11.setText("Tipo de Evento");

        cmbeventoCapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                cmbeventoCapacKeyPressed(evt);
            }
        });

        jLabel12.setText("Calificaci\u00f3n");

        jLabel13.setText("C.E");

        txtCECapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtCECapacKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCECapacKeyTyped(evt);
            }
        });

        btnGuardarCapaNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/saveall.gif")));
        btnGuardarCapaNuevo.setText("Guardar");
        btnGuardarCapaNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarCapaNuevoActionPerformed(evt);
            }
        });

        btnCancelarCapaNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/undo.gif")));
        btnCancelarCapaNuevo.setText("Cancelar");

        btnSalirCapaNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/close.gif")));
        btnSalirCapaNuevo.setText("Salir");
        btnSalirCapaNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirCapaNuevoActionPerformed(evt);
            }
        });

        jLabel2.setText("Rango");

        cmbrangoCapac.setEnabled(false);

        ftxtFecInicioCapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ftxtFecInicioCapacKeyPressed(evt);
            }
        });

        this.ftxtFecFinCapac= new javax.swing.JFormattedTextField(this.mascaraInicio);this.ftxtFecInicioCapac = new javax.swing.JFormattedTextField(this.mascaraFin);
        ftxtFecFinCapac.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ftxtFecFinCapacKeyPressed(evt);
            }
        });

        ftxtCosto.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ftxtCostoKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ftxtCostoKeyTyped(evt);
            }
        });

        ftxtDuracion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ftxtDuracionKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ftxtDuracionKeyTyped(evt);
            }
        });

        ftxtCalificacion.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ftxtCalificacionFocusLost(evt);
            }
        });
        ftxtCalificacion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ftxtCalificacionKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ftxtCalificacionKeyTyped(evt);
            }
        });

        jLabel14.setText("horas");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(14, 14, 14)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel3)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7)
                            .addComponent(jLabel12)
                            .addComponent(jLabel9)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)
                            .addComponent(jLabel10)
                            .addComponent(jLabel8))
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCECapac, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(cmbNivelCapac, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(cmbeventoCapac, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(ftxtFecFinCapac, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(ftxtFecInicioCapac, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cmbespecialidadCapac, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(txtcursoCapac, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                                        .addComponent(txtcodCapac, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(72, 72, 72))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(ftxtCalificacion, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                                    .addComponent(ftxtDuracion, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(ftxtCosto, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(84, 84, 84)
                                        .addComponent(jLabel2)
                                        .addGap(13, 13, 13)
                                        .addComponent(cmbrangoCapac, 0, 81, Short.MAX_VALUE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel14)))))))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(95, Short.MAX_VALUE)
                .addComponent(btnGuardarCapaNuevo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnCancelarCapaNuevo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSalirCapaNuevo)
                .addGap(25, 25, 25))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(txtcodCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtcursoCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbespecialidadCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel6)
                    .addComponent(ftxtCosto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ftxtDuracion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(cmbrangoCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ftxtCalificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbNivelCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbeventoCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCECapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ftxtFecFinCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(ftxtFecInicioCapac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCancelarCapaNuevo)
                    .addComponent(btnGuardarCapaNuevo)
                    .addComponent(btnSalirCapaNuevo))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void txtCECapacKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCECapacKeyTyped
// TODO add your handling code here:
        this.Letras(evt);
    }//GEN-LAST:event_txtCECapacKeyTyped

    private void ftxtCalificacionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtCalificacionKeyTyped
// TODO add your handling code here:
        this.Numeros(evt);
    }//GEN-LAST:event_ftxtCalificacionKeyTyped

    private void ftxtDuracionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtDuracionKeyTyped
// TODO add your handling code here:
        this.Numeros(evt);
    }//GEN-LAST:event_ftxtDuracionKeyTyped

    private void ftxtCostoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtCostoKeyTyped
// TODO add your handling code here:
        this.Numeros(evt);
    }//GEN-LAST:event_ftxtCostoKeyTyped

    private void txtcursoCapacKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcursoCapacKeyTyped
// TODO add your handling code here:
        this.LetrasNumerosUpper(evt);
    }//GEN-LAST:event_txtcursoCapacKeyTyped

    private void ftxtFecFinCapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtFecFinCapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.btnGuardarCapaNuevo.requestFocus();
        }
    }//GEN-LAST:event_ftxtFecFinCapacKeyPressed

    private void ftxtFecInicioCapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtFecInicioCapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.ftxtFecFinCapac.requestFocus();
        }
    }//GEN-LAST:event_ftxtFecInicioCapacKeyPressed

    private void txtCECapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCECapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.ftxtFecInicioCapac.requestFocus();
        }
    }//GEN-LAST:event_txtCECapacKeyPressed

    private void cmbeventoCapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cmbeventoCapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.txtCECapac.requestFocus();
        }
    }//GEN-LAST:event_cmbeventoCapacKeyPressed

    private void cmbNivelCapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cmbNivelCapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.cmbeventoCapac.requestFocus();
        }
    }//GEN-LAST:event_cmbNivelCapacKeyPressed

    private void ftxtCalificacionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtCalificacionKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.cmbNivelCapac.requestFocus();
        }
    }//GEN-LAST:event_ftxtCalificacionKeyPressed

    private void ftxtDuracionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtDuracionKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.ftxtCalificacion.requestFocus();
        }
    }//GEN-LAST:event_ftxtDuracionKeyPressed

    private void ftxtCostoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ftxtCostoKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.ftxtDuracion.requestFocus();
        }
    }//GEN-LAST:event_ftxtCostoKeyPressed

    private void cmbespecialidadCapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cmbespecialidadCapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.ftxtCosto.requestFocus();
        }
    }//GEN-LAST:event_cmbespecialidadCapacKeyPressed

    private void txtcursoCapacKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcursoCapacKeyPressed
// TODO add your handling code here:
        if(evt.getKeyCode()== evt.VK_ENTER){
            this.cmbespecialidadCapac.requestFocus();
        }
    }//GEN-LAST:event_txtcursoCapacKeyPressed

    private void ftxtCalificacionFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ftxtCalificacionFocusLost
// TODO add your handling code here:
        float calif = new Float(this.ftxtCalificacion.getText().trim()).floatValue();
        if(calif<=10){
            this.cmbrangoCapac.setSelectedItem("0-10");
        }else{
            if(calif<=15){
                this.cmbrangoCapac.setSelectedItem("11-15");
            }else{
                if(calif<=20){
                    this.cmbrangoCapac.setSelectedItem("16-20");
                }
                else{
                    this.mensaje("Calificacion no valida");
                }
            }
        }
        
    }//GEN-LAST:event_ftxtCalificacionFocusLost

    private void btnGuardarCapaNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarCapaNuevoActionPerformed
// TODO add your handling code here:
        String DNI, cod , curso,codesp, fecini, fecfin, codnivel, codevento, codrango,ce;
        float costo,calif;
        int durac;
        boolean ope;
        try{
            curso = this.txtcursoCapac.getText();
            codesp = this.getCliRMI().getObjetoCLIRMI().getCodigo("select cod_especialidad " +
                    "from Especialidad " +
                    "where desc_especialidad='"+(String)this.cmbespecialidadCapac.getSelectedItem()+"'",this.getID());
            fecini = this.ftxtFecInicioCapac.getText().trim();
            fecfin = this.ftxtFecFinCapac.getText().trim();
            codnivel = this.getCliRMI().getObjetoCLIRMI().getCodigo("select Cod_nivel_capacitacion " +
                    " from Nivel_capacitacion " +
                    " where nivel='"+(String)this.cmbNivelCapac.getSelectedItem()+"'",this.getID());
            codevento = this.getCliRMI().getObjetoCLIRMI().getCodigo("select cod_tipo_evento" +
                    " from tipo_evento " +
                    " where tipo_evento = '"+(String)this.cmbeventoCapac.getSelectedItem()+"'",this.getID());
            codrango = this.getCliRMI().getObjetoCLIRMI().getCodigo("select cod_rango " +
                    " from Rango_Calificaciones " +
                    " where descripcion='"+(String)this.cmbrangoCapac.getSelectedItem()+"'",this.getID());
            ce = this.txtCECapac.getText().trim();
            costo = new Float(this.ftxtCosto.getText()).floatValue();
            if(this.ftxtCalificacion.getText().equals("")){
                calif = 0;
            }
            else{
                calif = new Float(this.ftxtCalificacion.getText()).floatValue();
            }
            durac = Integer.parseInt(this.ftxtDuracion.getText().trim());
            if(this.VerficarDatos()==true){                
                if(this.Nuevo==true){
                    ope = this.getCliLegajo().getObjeto().Insertar_Capacitacion(this.DNI,curso,codesp,costo,durac,fecini,fecfin,codnivel,codevento,calif,codrango,ce, this.getID());
                }
                else{
                    ope = this.getCliLegajo().getObjeto().Actualizar_Capacitacion(this.DNI,this.cod_corr,curso,codesp,costo,durac,fecini,fecfin,codnivel,codevento,calif,codrango,ce, this.getID());
                }
                if(ope==true){
                    this.mensaje("La operacion se completo satisfactoriamente");
                    this.panTb.RestablecerTablaRemota();
                    this.CerrarDialogo();
                }else{
                    this.mensaje("La operacion no se pudo completar");
                }
            }else{
                this.mensaje("Ud. no ha ingresado todos los datos necesarios");
            }
        }catch(Exception e){
            this.mensaje("Error al guardar los cambios");
        }
        
    }//GEN-LAST:event_btnGuardarCapaNuevoActionPerformed

    private void btnSalirCapaNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirCapaNuevoActionPerformed
// TODO add your handling code here:
       int opc = javax.swing.JOptionPane.showConfirmDialog(this,"Esta seguro de Salir","Salir",javax.swing.JOptionPane.YES_NO_OPTION);
       if(opc==javax.swing.JOptionPane.YES_OPTION){
           CerrarDialogo();
       }
    }//GEN-LAST:event_btnSalirCapaNuevoActionPerformed
    public void CerrarDialogo(){
        this.cerrarPadre();
    }
    public boolean VerficarDatos(){ 
        if(this.ftxtFecInicioCapac.getText().trim().equals("/  /")||this.ftxtFecInicioCapac.getText().trim().equals("")){
            return false;
        }
        if(this.ftxtFecFinCapac.getText().trim().equals("/  /")||this.ftxtFecFinCapac.getText().trim().equals("")){
            return false;
        }
        if(this.txtCECapac.getText().trim().equals("")||this.txtcursoCapac.getText().equals("")||this.ftxtCosto.getText().equals("")
            ||this.ftxtDuracion.getText().equals("")){
            return false;
        }
        return true;
    }
    /*public void Letras(java.awt.event.KeyEvent evt){
        char [] cars = new char[1];
        char car;
        cars[0]= evt.getKeyChar();
        String c= new String(cars);
        c = c.toUpperCase();
        cars = c.toCharArray() ;
        car = cars[0];
        evt.setKeyChar(car);
        if((car<'A')||(car>'Z')&&(car!=evt.VK_ENTER)&&(car!=evt.VK_BACK_SPACE)&&(car!=evt.VK_SPACE)){
            evt.consume();
        }
    }*/
    public void setDNI(String DNI){
        this.DNI = DNI;
    }
    public void setActualizar(){
        this.actualizar = true;
        this.Nuevo = false;
    }
    public void setNuevo(){
        this.actualizar = false;
        this.Nuevo = true;
    }
    public void setcodNuevoCapacitacion(){
        try{
            cod_corr= this.getCliLegajo().getObjeto().ObtenerCodigoCapacitacion(DNI, this.getID());
            this.txtcodCapac.setText(cod_corr);
            System.out.println(""+cod_corr);
        }catch(Exception e){
            mensaje("Error: Al obtener codigo de Capacitacion");
        }
    }
    public void LlenarListas(){
        String Data[];   
        try{
            //tipo de Documentos
            Data = this.getCliRMI().getObjetoCLIRMI().getDatosLegajo("select desc_especialidad " +
                    " from Especialidad",this.getID());
            if(!Data.equals(null)){
                for(int i=0;i<Data.length;i++){
                    this.cmbespecialidadCapac.addItem(Data[i]);  
                }
            }           
            Data = this.getCliRMI().getObjetoCLIRMI().getDatosLegajo("select descripcion " +
                    "from Rango_Calificaciones",this.getID());
            if(!Data.equals(null)){
                for(int i=0;i<Data.length;i++){
                    this.cmbrangoCapac.addItem(Data[i]);  
                }
            }
            Data = this.getCliRMI().getObjetoCLIRMI().getDatosLegajo("select tipo_evento " +
                    " from Tipo_evento",this.getID());
            if(!Data.equals(null)){
                for(int i=0;i<Data.length;i++){
                    this.cmbeventoCapac.addItem(Data[i]);  
                }
            }
            Data = this.getCliRMI().getObjetoCLIRMI().getDatosLegajo("select nivel " +
                    " from nivel_Capacitacion",this.getID());
            if(!Data.equals(null)){
                for(int i=0;i<Data.length;i++){
                    this.cmbNivelCapac.addItem(Data[i]);  
                }
            }
        }catch(Exception e){
           mensaje("Error al Llenar Listas");
        }
    }    
    public void  mensaje(String msm){
            javax.swing.JOptionPane.showMessageDialog(this, msm);        
        }
    public void RecuperarDatosCapacitacion(String cod_corre){
        this.cod_corr= cod_corre;
        java.sql.ResultSet rs;
        String Datos[]=null;
        String cod_tipo_cod;
        String situacion;
        int edad=0;
        try{
            System.out.println("Datos del Historial");  
            String consulta = "SELECT    C.Nombre_curso, E.desc_especialidad as Especialidad, " +
                           " C.costo as Costo,C.Duracion_horas as Duracion,convert(char(10),C.fecha_inicio,103) as Inicio," +
                           " convert(char(10), C.fecha_fin,103)as Fin, N.nivel,te.tipo_evento,C.calificacion,R.descripcion, " +
                           " C.desc_CentroEstudios as [Centro de Estudios]  FROM    Capacitacion_complementaria C INNER JOIN " +
                           " Especialidad E ON C.cod_especialidad =E.cod_especialidad INNER JOIN  " +
                           " Tipo_Evento te ON C.cod_tipo_evento = te.cod_tipo_evento INNER JOIN" +
                           " Rango_calificaciones R ON C.cod_rango = R.cod_rango INNER JOIN " +
                           " Nivel_Capacitacion N ON C.Cod_nivel_capacitacion = N.Cod_nivel_capacitacion " +
                           " where C.DNI='"+this.DNI+"' and C.cod_capacitacion='"+this.cod_corr.trim()+"'";
            System.out.println(consulta);
                
                Datos = this.getCliRMI().getObjetoCLIRMI().getDatosFila(consulta,this.getID());
                if(!Datos.equals(null)){
                    this.txtcodCapac.setText(cod_corr);
                    this.txtcursoCapac.setText(Datos[0].trim());                    
                    this.cmbespecialidadCapac.setSelectedItem(Datos[1].trim());
                    this.ftxtCosto.setText(Datos[2].trim());
                    this.ftxtDuracion.setText(Datos[3].trim());
                    this.ftxtFecInicioCapac.setText(Datos[4].trim());
                    this.ftxtFecFinCapac.setText(Datos[5].trim());
                    this.cmbNivelCapac.setSelectedItem(Datos[6].trim());
                    this.cmbeventoCapac.setSelectedItem(Datos[7].trim());
                    this.ftxtCalificacion.setText(Datos[8].trim());
                    this.cmbrangoCapac.setSelectedItem(Datos[9].trim());
                    this.txtCECapac.setText(Datos[10].trim());                    
                }
                if(Datos!=null){
                    for(int i=0;i<Datos.length;i++){
                        System.out.print(Datos[i].trim()+",");
                    }
                    System.out.println("Termino de obtener Historial de Capacitaciones");
                }
                else{
                    javax.swing.JOptionPane.showMessageDialog(this,"El codigo de historial no existe");                
                }
        }catch(Exception e){
            System.out.println("Error obteniendo Historial de Caacitacion");
        }   
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelarCapaNuevo;
    private javax.swing.JButton btnGuardarCapaNuevo;
    private javax.swing.JButton btnSalirCapaNuevo;
    private javax.swing.JComboBox cmbNivelCapac;
    private javax.swing.JComboBox cmbespecialidadCapac;
    private javax.swing.JComboBox cmbeventoCapac;
    private javax.swing.JComboBox cmbrangoCapac;
    private javax.swing.JFormattedTextField ftxtCalificacion;
    private javax.swing.JFormattedTextField ftxtCosto;
    private javax.swing.JFormattedTextField ftxtDuracion;
    private javax.swing.JFormattedTextField ftxtFecFinCapac;
    private javax.swing.JFormattedTextField ftxtFecInicioCapac;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField txtCECapac;
    private javax.swing.JTextField txtcodCapac;
    private javax.swing.JTextField txtcursoCapac;
    // End of variables declaration//GEN-END:variables
    String DNI;
    boolean flag_lista = false;   
    boolean actualizar = false;
    boolean Nuevo =false;
    String cod_corr;    
    String cod_persona;
    javax.swing.text.MaskFormatter mascaraInicio;
    javax.swing.text.MaskFormatter mascaraFin;    
}
